#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H

#include <QObject>
#include <QNetworkConfigurationManager>
#include "NetworkPing.h"

class QTimer;

class NetworkManager: public QObject
{
    Q_OBJECT
public:
    NetworkManager(const QList<std::string> &list);

    void start();
    void stop();

signals:
    void onlineState(bool isOnline);

protected slots:
    void onLinuxState(bool isOnline);
    void onWinMacState(NetworkPingState state);

private:
    QList<std::string> m_pingList;

    bool isEmitSignal = false;
#ifdef __linux__
    QNetworkConfigurationManager m_manager;
#else
    QTimer *m_pingTimer = nullptr;
    NetworkPing *m_ping = nullptr;
    uint8_t m_pingErrorCount = 0;
    bool m_lastNetState = true;
#endif
};

#endif // NETWORKMANAGER_H
